<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libslic3r: src/libslic3r/SlicingAdaptive.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Slic3r_192px_transparent.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libslic3r
   </div>
   <div id="projectbrief">Library for generating gcode from 3d models</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_f69e6fbaea45487e96bc9ed8ccf9ff8f.html">libslic3r</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">SlicingAdaptive.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_slicing_adaptive_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef slic3r_SlicingAdaptive_hpp_</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define slic3r_SlicingAdaptive_hpp_</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;admesh/stl.h&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_slic3r.html">Slic3r</a></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;{</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="keyword">class </span>TriangleMesh;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html">   11</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_slic3r_1_1_slicing_adaptive.html">SlicingAdaptive</a></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;{</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#a090d63997be6ad60a9ba6e17bc6532fc">   14</a></span>&#160;    <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a090d63997be6ad60a9ba6e17bc6532fc">SlicingAdaptive</a>() {};</div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#a1e7531cf22c945c1c851ba767010462b">   15</a></span>&#160;    <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a1e7531cf22c945c1c851ba767010462b">~SlicingAdaptive</a>() {};</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a81928cc3b1b8691092e1fadbfb6a1348">clear</a>();</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#ae2f4e804fd7f2dd87cfdea28442f039d">   17</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#ae2f4e804fd7f2dd87cfdea28442f039d">add_mesh</a>(<span class="keyword">const</span> <a class="code" href="class_slic3r_1_1_triangle_mesh.html">TriangleMesh</a> *mesh) { <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#abdceaa37b06be452dd9d320a15747056">m_meshes</a>.push_back(mesh); }</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#adbdeaa54e465cbd0742a53d49ebf0aa0">prepare</a>(<a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a55ec338384b0929913ac1c3332edf377">object_size</a>);</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a3e5e9cdb878d1ab83b7f8e79009afe85">next_layer_height</a>(<a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> z, <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> quality_factor, <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> min_layer_height, <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> max_layer_height);</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <span class="keywordtype">float</span> <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a6f43185498e2524ea3c786a25401989c">horizontal_facet_distance</a>(<a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> z, <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a> max_layer_height);</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">private</span>:</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <span class="keywordtype">float</span> _layer_height_from_facet(<span class="keywordtype">int</span> ordered_id, <span class="keywordtype">float</span> scaled_quality_factor);</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="comment">// id of the current facet from last iteration</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#a55ec338384b0929913ac1c3332edf377">   27</a></span>&#160;    <a class="code" href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">coordf_t</a>                            <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a55ec338384b0929913ac1c3332edf377">object_size</a>;</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#ad79d505a5a40ce29ceab1a0868da7c4b">   28</a></span>&#160;    <span class="keywordtype">int</span>                                 <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#ad79d505a5a40ce29ceab1a0868da7c4b">current_facet</a>;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#abdceaa37b06be452dd9d320a15747056">   29</a></span>&#160;    std::vector&lt;const TriangleMesh*&gt;    <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#abdceaa37b06be452dd9d320a15747056">m_meshes</a>;</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="comment">// Collected faces of all meshes, sorted by raising Z of the bottom most face.</span></div><div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#a6e76e5733924866e4b81c167ecd2057c">   31</a></span>&#160;    std::vector&lt;const stl_facet*&gt;       <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a6e76e5733924866e4b81c167ecd2057c">m_faces</a>;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="comment">// Z component of face normals, normalized.</span></div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="class_slic3r_1_1_slicing_adaptive.html#a7444bfda5b9014b42398faaf813ae792">   33</a></span>&#160;    std::vector&lt;float&gt;                  <a class="code" href="class_slic3r_1_1_slicing_adaptive.html#a7444bfda5b9014b42398faaf813ae792">m_face_normal_z</a>;</div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;};</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;}; <span class="comment">// namespace Slic3r</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* slic3r_SlicingAdaptive_hpp_ */</span><span class="preprocessor"></span></div><div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_ae2f4e804fd7f2dd87cfdea28442f039d"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#ae2f4e804fd7f2dd87cfdea28442f039d">Slic3r::SlicingAdaptive::add_mesh</a></div><div class="ttdeci">void add_mesh(const TriangleMesh *mesh)</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:17</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a7444bfda5b9014b42398faaf813ae792"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a7444bfda5b9014b42398faaf813ae792">Slic3r::SlicingAdaptive::m_face_normal_z</a></div><div class="ttdeci">std::vector&lt; float &gt; m_face_normal_z</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:33</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_adbdeaa54e465cbd0742a53d49ebf0aa0"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#adbdeaa54e465cbd0742a53d49ebf0aa0">Slic3r::SlicingAdaptive::prepare</a></div><div class="ttdeci">void prepare(coordf_t object_size)</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.cpp:38</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html">Slic3r::SlicingAdaptive</a></div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:11</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_ad79d505a5a40ce29ceab1a0868da7c4b"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#ad79d505a5a40ce29ceab1a0868da7c4b">Slic3r::SlicingAdaptive::current_facet</a></div><div class="ttdeci">int current_facet</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:28</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a6e76e5733924866e4b81c167ecd2057c"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a6e76e5733924866e4b81c167ecd2057c">Slic3r::SlicingAdaptive::m_faces</a></div><div class="ttdeci">std::vector&lt; const stl_facet * &gt; m_faces</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:31</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_abdceaa37b06be452dd9d320a15747056"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#abdceaa37b06be452dd9d320a15747056">Slic3r::SlicingAdaptive::m_meshes</a></div><div class="ttdeci">std::vector&lt; const TriangleMesh * &gt; m_meshes</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:29</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a090d63997be6ad60a9ba6e17bc6532fc"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a090d63997be6ad60a9ba6e17bc6532fc">Slic3r::SlicingAdaptive::SlicingAdaptive</a></div><div class="ttdeci">SlicingAdaptive()</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:14</div></div>
<div class="ttc" id="namespace_slic3r_html_a2ac5c755948c74f5f5f975acd5057fe9"><div class="ttname"><a href="namespace_slic3r.html#a2ac5c755948c74f5f5f975acd5057fe9">Slic3r::coordf_t</a></div><div class="ttdeci">double coordf_t</div><div class="ttdef"><b>Definition:</b> libslic3r.h:42</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a1e7531cf22c945c1c851ba767010462b"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a1e7531cf22c945c1c851ba767010462b">Slic3r::SlicingAdaptive::~SlicingAdaptive</a></div><div class="ttdeci">~SlicingAdaptive()</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:15</div></div>
<div class="ttc" id="namespace_slic3r_html"><div class="ttname"><a href="namespace_slic3r.html">Slic3r</a></div><div class="ttdef"><b>Definition:</b> BoundingBox.cpp:4</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a55ec338384b0929913ac1c3332edf377"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a55ec338384b0929913ac1c3332edf377">Slic3r::SlicingAdaptive::object_size</a></div><div class="ttdeci">coordf_t object_size</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.hpp:27</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a6f43185498e2524ea3c786a25401989c"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a6f43185498e2524ea3c786a25401989c">Slic3r::SlicingAdaptive::horizontal_facet_distance</a></div><div class="ttdeci">float horizontal_facet_distance(coordf_t z, coordf_t max_layer_height)</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.cpp:156</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a81928cc3b1b8691092e1fadbfb6a1348"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a81928cc3b1b8691092e1fadbfb6a1348">Slic3r::SlicingAdaptive::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.cpp:24</div></div>
<div class="ttc" id="class_slic3r_1_1_triangle_mesh_html"><div class="ttname"><a href="class_slic3r_1_1_triangle_mesh.html">Slic3r::TriangleMesh</a></div><div class="ttdef"><b>Definition:</b> TriangleMesh.hpp:20</div></div>
<div class="ttc" id="class_slic3r_1_1_slicing_adaptive_html_a3e5e9cdb878d1ab83b7f8e79009afe85"><div class="ttname"><a href="class_slic3r_1_1_slicing_adaptive.html#a3e5e9cdb878d1ab83b7f8e79009afe85">Slic3r::SlicingAdaptive::next_layer_height</a></div><div class="ttdeci">float next_layer_height(coordf_t z, coordf_t quality_factor, coordf_t min_layer_height, coordf_t max_layer_height)</div><div class="ttdef"><b>Definition:</b> SlicingAdaptive.cpp:67</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
